using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Commerce.Common;

public partial class Modules_RecentProductsViewed : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            
            rptRecentProds.DataSource = SPs.StatsFavoriteProducts(Utility.GetUserName()).GetReader();
            rptRecentProds.DataBind();

            pnlProd.Visible = rptRecentProds.Items.Count > 0;

        }
    }
    public int GetCount()
    {

        return rptRecentProds.Items.Count; 
    }
    protected string GetImagePath(object img)
    {
        string sOut = string.Empty;
				if(img != null) {
					if(img.ToString().Trim().Length != 0) {
            sOut= Page.ResolveUrl("~/"+img.ToString());
					}
					else {
						sOut = Page.ResolveUrl("~/images/ProductImages/no_image_available_small.gif");
					}
				}
				else {
					sOut = Page.ResolveUrl("~/images/ProductImages/no_image_available_small.gif");
				}
        return sOut;
    }

}
